#include <boost/test/unit_test.hpp>

#include <phalanx/type_traits/integral_constant.hpp.cu>
#include <phalanx/type_traits/is_same.hpp.cu>
using namespace phalanx;

namespace ns_integral
{

BOOST_AUTO_TEST_CASE( bool_check )
{
    BOOST_REQUIRE(( !false_type::value ));
    BOOST_REQUIRE(( !false_type() ));

    BOOST_REQUIRE(( true_type::value ));
    BOOST_REQUIRE(( true_type() ));

    BOOST_REQUIRE(( is_same< false_type, false_type::type >() ));
    BOOST_REQUIRE(( is_same< true_type, true_type::type >() ));
}

BOOST_AUTO_TEST_CASE( integral_check )
{
    BOOST_REQUIRE(( integral_constant< int, 0 >::value == 0 ));
    BOOST_REQUIRE(( integral_constant< int, 1 >::value == 1 ));
    BOOST_CHECK(( integral_constant< int, -1 >::value == -1 ));

    BOOST_REQUIRE(( integral_constant< int, 0 >() == 0 ));
    BOOST_REQUIRE(( integral_constant< int, 1 >() == 1 ));
    BOOST_CHECK(( integral_constant< int, -1 >() == -1 ));

    BOOST_REQUIRE(( integral_constant< unsigned int, 0u >::value == 0u ));
    BOOST_REQUIRE(( integral_constant< unsigned int, 1u >::value == 1u ));

    BOOST_REQUIRE(( integral_constant< unsigned int, 0u >() == 0u ));
    BOOST_REQUIRE(( integral_constant< unsigned int, 1u >() == 1u ));

    BOOST_REQUIRE(( integral_constant< signed int, 0 >::value == 0 ));
    BOOST_REQUIRE(( integral_constant< signed int, 1 >::value == 1 ));
    BOOST_REQUIRE(( integral_constant< signed int, -1 >::value == -1 ));

    BOOST_REQUIRE(( integral_constant< signed int, 0 >() == 0 ));
    BOOST_REQUIRE(( integral_constant< signed int, 1 >() == 1 ));
    BOOST_REQUIRE(( integral_constant< signed int, -1 >() == -1 ));
}

} // namespace ns_integral

